package com.egao.oa.service.impl;

import com.egao.common.core.damon.results.PageResult2;
import com.egao.common.core.web.JsonResult;
import com.egao.common.system.entity.User;
//import com.egao.oa.mapper.Oa_scheduleMapper;
import com.egao.oa.entity.Oa_schedule;
import com.egao.oa.service.ScheduleService;
import org.springframework.stereotype.Service;
import com.egao.oa.biz.ScheduleBiz;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;

/**
 * 行程计划提醒服务实现类
 * @author : Doman
 * @date : 2020-09-18 14:18:11
 * @version ：1.0
 */
@Service
public class ScheduleServiceImpl /*extends ServiceImpl<Oa_scheduleMapper, Oa_schedule> */implements ScheduleService {

	@Autowired
	private ScheduleBiz scheduleBiz;

    /**
    @Override
    public PageResult<Oa_schedule> listPage(PageParam<Oa_schedule> page) {
        List<Oa_schedule> records = baseMapper.listPage(page);
        return new PageResult<>(records, page.getTotal());
    }

    @Override
    public List<Oa_schedule> listAll(Map<String, Object> page) {
        return baseMapper.listAll(page);
    } */

    @Override
    public JsonResult list(PageResult2<T> page, Oa_schedule oa_schedule, User loginUser)  throws Exception{
        return scheduleBiz.list(page,oa_schedule,loginUser);
    }

    @Override
    public List<Oa_schedule> list(Oa_schedule oa_schedule, User loginUser) {
        return scheduleBiz.list(oa_schedule,loginUser);
    }

    @Override
    public JsonResult getById(Oa_schedule oa_schedule) {
        return JsonResult.ok().setData(scheduleBiz.getById(oa_schedule));
    }

    @Transactional
    @Override
    public JsonResult save(Oa_schedule oa_schedule, User loginUser) {
        if (scheduleBiz.save(oa_schedule, loginUser)) {
            return JsonResult.ok("添加成功");
        }
        return JsonResult.error("添加失败");
    }

    @Transactional
    @Override
    public JsonResult update(Oa_schedule oa_schedule, User loginUser) {
        if (scheduleBiz.update(oa_schedule, loginUser)) {
            return JsonResult.ok("修改成功");
        }
        return JsonResult.error("修改失败");
    }

    @Transactional
    @Override
    public JsonResult remove(Oa_schedule oa_schedule, User loginUser) {
        if (scheduleBiz.remove(oa_schedule, loginUser)) {
            return JsonResult.ok("删除成功");
        }
        return JsonResult.error("删除失败");
    }

}
